package crudfx.container;
import crudfx.interop.*;
import javax.swing.*;
import java.awt.event.*;
import crudfx.data.*;
/**
 * @profile desktop
 * @author Sergey Surikov
 */
public class Spectator extends UIComponent {
    var panel:JamTop;
    public var content:UIComponent;
    public var clicked:function(e:MouseEvent):Void;
    public var entered:function(e:MouseEvent):Void;
    public var exited:function(e:MouseEvent):Void;
    public var pressed:function(e:MouseEvent):Void;
    public var released:function(e:MouseEvent):Void;
    init{
        panel=JamTop{
            content:bind content
            }
        panel.getJComponent().addMouseListener(
            MouseListener{
                override function mouseClicked(e:MouseEvent):Void{clicked(e);}
                override function mouseEntered(e:MouseEvent):Void{entered(e);}
                override function mouseExited(e:MouseEvent):Void{exited(e);}
                override function mousePressed(e:MouseEvent):Void{pressed(e);}
                override function mouseReleased(e:MouseEvent):Void{released(e);}
                }
            );
        }
    override public function getJComponent():JComponent{
        return panel.getJComponent();
        }
    override public function highlight(s:String):Boolean{
        return panel.highlight(s);
        }
    override public function gather():DataTree{
        var me:DataTree=DataTree{ name:"Spectator" };
        insert content.gather() into me.node("content").children;
        return me;
        }
    }
